<?php
  /**
   * @author EVANDRO DE OLIVEIRA.
   * @category VIEW
   * @package VIEWS/SCRIPTS/PAISES.
   * @since 17/06/2012.
   * @last_update 17/06/2012.
   * @copyright 2012.
   * @version 1.0.
   *
   */
  $objCurrency = new Zend_Currency();
?>
<table border="0" align="center" cellpadding="0" cellspacing="0" class="content-view" id="teste">
  <tr>
    <td id="messenger" colspan="2"><?php echo $this->flashMessage();?></td>
  </tr>
  <tr>
    <td align="left" class="comp-title" style="width: 200px;">CONSULTA DE ALUNOS</td>  
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td align="center" colspan="2" style="">
      <table border="0" align="center" cellpadding="0" cellspacing="0" width="100%" class="content-form">
        <tr>
          <td class="space-bottom"></td>
        </tr>
        <tr>
          <td>
            <form name="form_add" method="post" action="" id="form_add">
              <table border="0" align="center" cellpadding="0" cellspacing="0" width="100%">
                <tr>
                  <td align="left" class="title-dp">dados pessoais</td> 
                  <td>&nbsp;</td> 
							  </tr>
                <tr>
                  <td class="content-dp" colspan="2">
                    <table border="0" cellpadding="0" cellspacing="0">
                      <?php   
                        foreach($this->arrColunas as $strKey => $arrValues){
				                    switch($arrValues['type']){
				                      case 'text':
				                        $strCampo = $this->input($arrValues['type'], $arrValues['name'], $arrValues['name'], $this->request[$arrValues['name']], false, '', $arrValues['maxlength'], '', "width: {$arrValues['width']}px;");
				                      break;
				                      
				                      case 'textarea':
				                        $strCampo = $this->textarea($arrValues['name'], $arrValues['name'], $this->request[$arrValues['name']], false, $arrValues['cols'], $arrValues['rows']);
				                      break;
				                      
				                      case 'db_combo':
				                        $strCampo = $this->dbComboBox($arrValues['name'], $arrValues['name'], $arrValues['model'], $arrValues['value'], $arrValues['label'], isset($this->request[$arrValues['value']]) ? $this->request[$arrValues['value']] : '', isset($this->request[$arrValues['label']]) ? $this->request[$arrValues['label']] : 'Selecione', false);
				                      break;
				
				                      case 'combo':
				                        //$strCampo = $this->comboBox($arrValues['name'], $arrValues['name'], $arrValues['options'], $this->request[$arrValues['name']], false);
				                        $strCampo = $this->comboBox($arrValues['name'], $arrValues['name'], $arrValues['options'], !empty($arrValues['name']) ? $this->request[$arrValues['name']] : 'Selecione', false);
				                      break;
				                      
				                      case 'date':
				                      case 'datetime':
				                      	$arrDataValue =  explode(" ", $this->request[$arrValues['name']]);                      	
				                      	$strDate = implode('/', array_reverse(explode('-', $arrDataValue[0])));
				                        $strCampo = $this->input('text', $arrValues['name'], $arrValues['name'] , $strDate, false, '', '', $arrValues['maxlength'], "width: {$arrValues['width']}px;");
				                      break;
				                    }
				                    ?>  
		                        <tr>
		                          <td align="right" class="label"><?php echo $strKey?>:</td>  
		                          <td align="left" class="space-bottom"><?php echo $strCampo?></td>                      
		                        </tr>
		                        <?php
		                      }
		                    ?>
		                  </table>
                  </td>
                </tr>
                <tr>  
                  <td align="center" colspan="3">&nbsp;</td>
                </tr>
              </table>
              
              <table border="0" align="center" cellpadding="0" cellspacing="0" width="100%">
                <tr>
                  <td align="left" class="title-dp">Curso e Turma</td> 
                  <td>&nbsp;</td>  
                </tr>
                <tr>
                  <td class="content-dp" colspan="2">
                    <table border="0" cellpadding="0" cellspacing="0">
                      <?php   
                        foreach($this->arrColunas2 as $strKey => $arrValues){
                            switch($arrValues['type']){
                              case 'db_combo':
                                $strCampo = $this->dbComboBox($arrValues['name'], $arrValues['name'], $arrValues['model'], $arrValues['value'], $arrValues['label'], isset($this->request[$arrValues['value']]) ? $this->request[$arrValues['value']] : '', isset($this->request[$arrValues['label']]) ? $this->request[$arrValues['label']] : 'Selecione', false);
                              break;
        
                              case 'combo':
                                //$strCampo = $this->comboBox($arrValues['name'], $arrValues['name'], $arrValues['options'], $this->request[$arrValues['name']], false);
                                $strCampo = $this->comboBox($arrValues['name'], $arrValues['name'], $arrValues['options'], !empty($arrValues['name']) ? $this->request[$arrValues['name']] : 'Selecione', false);
                              break;
                            }
                            ?>  
                            <tr>
                              <td align="right" class="label"><?php echo $strKey?>:</td>  
                              <td align="left" class="space-bottom"><?php echo $strCampo?></td>                      
                            </tr>
                            <?php
                          }
                        ?>
                      </table>
                  </td>
                </tr>
                <tr>  
                  <td align="center" colspan="3">&nbsp;</td>
                </tr>
              </table>
              
              <table border="0" align="center" cellpadding="0" cellspacing="0" width="100%">
                <tr>
                  <td align="left" class="title-dp">Preço e Opção de Parcelamento</td> 
                  <td>&nbsp;</td>  
                </tr>
                <tr>
                  <td class="content-dp" colspan="2">
                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                      <?php   
                        foreach($this->arrColunas3 as $strKey => $arrValues){
                            switch($arrValues['type']){
                              case 'text':
                                $strCampo = $this->input($arrValues['type'], $arrValues['name'], $arrValues['name'], $objCurrency->setValue($this->request[$arrValues['name']]), false, '', $arrValues['maxlength'], '', "width: {$arrValues['width']}px;");
                              break;
                            }
                            ?>  
                            <tr>
                              <td align="right" class="label" style="width: 15%"><?php echo $strKey?>:</td>  
                              <td align="left" class="space-bottom"><?php echo $strCampo?></td>                      
                            </tr>
                            <?php
                          }
                        ?>
                        <tr>  
                          <td align="center" colspan="2">&nbsp;</td>
                        </tr>
                        <tr>
                          <td colspan="2">
                            <table border="0" align="center" cellpadding="0" cellspacing="0" width="70%">
				                      <thead> 
				                        <tr> 
				                          <th class="title-list" style="width: 7%"></th> 
				                          <th class="title-list">Condição</th> 
				                          <th class="title-list">Valor</th>  
				                        </tr> 
				                      </thead> 
				                      <tbody>
				                        <?php 
				                          $intCounter = count($this->arrParcelas);
				                          $arrUltimaParcela = end($this->arrParcelas);
				                        ?>
				                        <tr>
				                          <td class="result-list">
				                            <input type="radio" name="ds_parcela" id="ds_parcela" value="<?php echo $arrUltimaParcela['nr_parcela']?>" checked="checked" readonly="readonly"/>
				                          </td>
				                          <td class="result-list" style="text-align: left;">
				                            <?php 
				                              if($arrUltimaParcela['nr_parcela'] == 1)
				                              	echo 'À VISTA';
				                              else
				                                echo $arrUltimaParcela['nr_parcela'] . 'X';
				                            ?>
				                          </td>
			                            <td class="result-list">
			                              <?php echo $objCurrency->setValue($arrUltimaParcela['nr_valor']);?>
			                            </td>
			                          </tr>
				                      </tbody>
				                    </table>
                          </td>
                        </tr>
                      </table>
                  </td>
                </tr>
                <tr>  
                  <td align="center" colspan="3">&nbsp;</td>
                </tr>
              </table>
              
              <table border="0" align="center" cellpadding="0" cellspacing="0" width="100%">
                <tr>
                  <td align="left" class="title-dp">Contrato</td> 
                  <td>&nbsp;</td>  
                </tr>
                <tr>
                  <td class="content-dp" colspan="2">
                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                      <?php   
                        foreach($this->arrColunas4 as $strKey => $arrValues){
                        	switch($arrValues['type']){
                            case 'checkbox':
                            	$strChecked = '';
                            	if($this->request[$arrValues['name']] == 1)
                                $strChecked = 'checked="checked"';     
                                                       	 
                              $strCampo = $this->input($arrValues['type'], $arrValues['name'], $arrValues['name'], $this->request[$arrValues['name']], false, '', '', '', '', true);
                            break;
                          }
                          ?>  
                          <tr>
                            <td align="right" class="label" style="width: 20%"><?php echo $strKey?>:</td>  
                            <td align="left" class="space-bottom" style="padding-top: 8px;">
                              <?php echo $strCampo?> 
                              <span style="float: right;">
                                <a href="<?php echo $this->baseUrlController?>/contrato/cod/<?php echo $this->request['idAluno']?>" target="blank" style="text-decoration: none; font-weight: bold; font-size: 12px; color: #344796;">
                                  Visualizar Contrato
                                </a>
                              </span>
                            </td>                      
                          </tr>
                          <?php
                        }
                      ?>
                      <tr>
                        <td colspan="2">&nbsp;</td>
                      </tr>
                    </table>
                  </td>
                </tr>
                <tr>  
                  <td align="center" colspan="3">&nbsp;</td>
                </tr>
              </table>        
              
              <table border="0" align="center" cellpadding="0" cellspacing="0" width="100%">
                <tr>
                  <td align="left" class="title-dp">Impressão de Boletos</td> 
                  <td>&nbsp;</td>  
                </tr>
                <tr>
                  <td class="content-dp" colspan="2">
                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                      <thead> 
                        <tr> 
                          <th class="title-list" style="width: 7%"></th> 
                          <th class="title-list">Parcela</th> 
                          <th class="title-list">Valor</th>
                          <th class="title-list">Vencimento</th>
                          <th class="title-list">Ação</th>  
                        </tr> 
                      </thead> 
                      <tbody>
                        <?php 
                          foreach($this->arrParcelas as $arrContasReceber){
                            //Zend_Debug::dump($arrContasReceber);
                            ?>
                            <tr>
                              <td class="result-list"></td>
                              <td class="result-list" style="text-align: left;">
                                Parcela <?php echo $arrContasReceber['nr_parcela']?>
                              </td>
                              <td class="result-list">
                                <?php echo $objCurrency->setValue($arrContasReceber['nr_valor']);?>
                              </td>
                              <td class="result-list">
                                <?php echo implode('/', array_reverse(explode('-', $arrContasReceber['dt_vencimento'])));?>
                              </td>
                              <td class="result-list">
                                <a class="link_imprimir" href="<?php echo $this->baseUrlController?>/gera-boleto/c/<?php echo $arrContasReceber['idConta_receber']?>/a/<?php echo $arrContasReceber['idAluno']?>/m/<?php echo $arrContasReceber['idModulo']?>" target="blank" style="text-decoration: none; font-weight: bold; font-size: 12px; color: #344796;">
                                  Imprimir Boleto
                                </a>
                              </td>
                            </tr>
                            <?php
                          }
                        ?>
                      </tbody>
                    </table>
                  </td>
                </tr>
              </table>        
              <table border="0" align="center" cellpadding="0" cellspacing="0" width="100%">
                <tr>  
                  <td align="center" colspan="3">&nbsp;</td>
                </tr>
                <tr>  
                  <td align="center" colspan="3">
                    <?php 
                      echo $this->input('button', 'cancel', 'boton', 'Retornar', true, '', '', '', '', "onclick=\"window.location='" . $this->baseUrl . "/matriculas/list'\"");
                    ?>
                  </td>
                </tr>
              </table>
            </form>
          </td>
        </tr>
      </table>
    </td>
  </tr>  
</table>